package com.dgut.admodule.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@Entity
@Table(name="t_bidding")
public class Bidding {
	private Long bidId;
	@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
	private Date biddingbTime;
	@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
	private Date biddingsTime;
	private Double minPrice;
	@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
	private Date adsbTime;
	@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
	private Date adssTime;
	private List<Adsbid> adsbid = new ArrayList<Adsbid>();
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getBidId() {
		return bidId;
	}
	@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss",timezone = "GMT+8")
	public Date getBiddingbTime() {
		return biddingbTime;
	}
	@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss",timezone = "GMT+8")
	public Date getBiddingsTime() {
		return biddingsTime;
	}
	public Double getMinPrice() {
		return minPrice;
	}
	@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss",timezone = "GMT+8")
	public Date getAdsbTime() {
		return adsbTime;
	}
	@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss",timezone = "GMT+8")
	public Date getAdssTime() {
		return adssTime;
	}
	@OneToMany(cascade=CascadeType.ALL,mappedBy="bidding",fetch=FetchType.EAGER)
	public List<Adsbid> getAdsbid() {
		return adsbid;
	}
	
	public void setBidId(Long bidId) {
		this.bidId = bidId;
	}
	public void setAdsbid(List<Adsbid> adsbid) {
		this.adsbid = adsbid;
	}
	public void setBiddingbTime(Date biddingbTime) {
		this.biddingbTime = biddingbTime;
	}
	public void setBiddingsTime(Date biddingsTime) {
		this.biddingsTime = biddingsTime;
	}
	public void setMinPrice(Double minPrice) {
		this.minPrice = minPrice;
	}
	public void setAdsbTime(Date adsbTime) {
		this.adsbTime = adsbTime;
	}
	public void setAdssTime(Date adssTime) {
		this.adssTime = adssTime;
	}
	
	@Override
	public String toString() {
		return "Bidding [bidId=" + bidId + ", biddingbTime=" + biddingbTime + ", biddingsTime=" + biddingsTime
				+ ", minPrice=" + minPrice + ", adsbTime=" + adsbTime + ", adssTime=" + adssTime + "]";
	}
	
}
